package com.baosight.sczx.zm.service;

import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.cInterface.Department;
import com.baosight.sczx.common.zm.cInterface.User;
import com.baosight.sczx.common.zm.cInterface.cl.RoundCheckWorkNote;
import com.baosight.sczx.common.zm.cInterface.cs.InitialData;
import com.baosight.sczx.common.zm.cInterface.cs.WorkSchedule;
import com.baosight.sczx.zm.domain.ZM9C;

/**
 * 
 * <p>Title: ServiceZM9C.java</p>
 * <p>Description: 首页隐患查询--更多</p>
 * <p>Copyright: Baosight Software LTD.co Copyright (c) 2002</p>
 * <p>Company: Baosight Software</p>
 * @author 郭淑芳
 * @version 1.0
 * <pre>Histroy:
 *          2012-12-25 上午01:34:02  郭淑芳  Create
 *</pre>
 */
public class ServiceZM9C extends ServiceEPBase {
	
	/**
	 * 
	 * <p>Function: initLoad</p>
	 * <p>Description: 初始化</p>
	 * <p>return value: ServiceZM9C</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2012-12-25上午01:33:52 郭淑芳
	 * </p>
	 *
	 */
	@Override
	public EiInfo initLoad(EiInfo inInfo) 
	{
		inInfo.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		EiInfo outInfo  = this.query(inInfo);
		
		outInfo.addBlock(Department.getInstance().getConstructionUnit("cmes.cl.orgName", "orgCode", "orgName", true));//隐患部门
		outInfo.addBlock(User.getInstance().getConstructionStaff("cmes.cl.empName", "empCode", "empName", true));//人员
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cl.riskSource", true));//隐患来源
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cl.riskLevel", true));//隐患级别
		outInfo.addBlock(InitialData.getInstance().getEiBlockByNo("cmes.cl.riskClassify", true));//隐患分类
		outInfo.addBlock(WorkSchedule.getWorkScheduleBlock("cmes.cl.riskWorknum", false));//隐患班次
		//outInfo.addBlock(WorkingFace.getAllWorkingFace("cmes.cl.workface", true));//所在工作面
		//outInfo.addBlock(RoadWay.getAllRoadWay("cmes.cl.path", true));//所在巷道
		outInfo.addBlock(RoundCheckWorkNote.getAllNoteCode("cmes.cl.workNote", true));//巡检工单
		
		return outInfo;
	}
	
	/**
	 * 
	 * <p>Function: query</p>
	 * <p>Description: 隐患查询</p>
	 * <p>return value: ServiceZM9C</p>
	 * <p>throws Exception:</p>
	 * <p>History:
	 *    2012-12-25上午01:33:39 郭淑芳
	 * </p>
	 *
	 */
	public EiInfo query(EiInfo inInfo) {
		if(inInfo.getBlock(EiConstant.queryBlock) == null){
			StaticTools.setQueryParameters(inInfo, "fdEndDate", StaticTools.getDate(), true);//截止日期
		}
		
		StaticTools.setQueryParameters(inInfo, "isHandling", "yes", true);
		EiInfo outInfo = super.query(inInfo, "ZM9C.query", new ZM9C());
		
		return outInfo;
	}
}
